﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Article.aspx.cs" Inherits="bl_Article" %>

<%@ MasterType VirtualPath="~/Site.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#replydiv").hide();

            $("#respond").click(function () {
                $("#replydiv").slideToggle();
            });
            $("#commentAuthor").focus(function () {
                $(this).addClass("selectedinput");
            });
            $("#commentAuthor").focusout(function () {
                $(this).removeClass("selectedinput");
            });

            $("#commentText").focus(function () {
                $(this).addClass("selectedinput");
            });
            $("#commentText").focusout(function () {
                $(this).removeClass("selectedinput");
            });

            $("#submitComment").click(function () {
                PerformCallback();
            });
            $("#commentText").keyup(function (e) {
                if (e.which == 13 && !e.shiftKey) {
                    PerformCallback();
                }
            });
            function PerformCallback() {
                var text = $("#commentText").val();
                var author = $("#commentAuthor").val();
                var commentsCount = $("#comms > li").size();
                var params = "Add Comment|" + author + "|" + text + "|" + commentsCount;
                CallServer(params, "");
            }
        });
        function ReceiveServerData(arg, context) {
            var parts = arg.split("|");
            switch (parts[0]) {
                case "Success":
                    {
                        if ($("#comms").length == 0) {
                            $("#respond").after("<h3 id='comments'>1 Response</h3>" +
                                "<ol id='comms' class='commentlist'></ol>");
                        }
                        $("#comms > li").removeClass("addedd");
                        $("#comms").append(parts[1]);

                        $("#comms > li.addedd").animate({
                            "font-size": "20"
                        }, 500);
                        $("#comms > li.addedd").animate({
                            "font-size": "1.2em"
                        }, 500);
                        $("#comments").text($("#comms > li").size() + " Responses");
                        //$("#comms > li.addedd").animate({ "background-color": "red" }, 1000).animate({ "background-color": "transparent" }, 1000);
                        //$("#comms > li.added").removeClass('added');

                        break;
                    }
                case "Error":
                    break;
                case "Fail":
                    break;
                default:
                    break;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="content" class="widecolumn">
        <div class="navigation">
            <div class="alignleft">
                « <a id="prevArticle" runat="server" href="#"></a>
            </div>
            <div class="alignright">
                <a id="nextArticle" runat="server" href="#"></a>»
            </div>
        </div>
        <div class="date">
            <div class="date_month">
                <asp:Literal ID="DateMonth" runat="server"></asp:Literal>
            </div>
            <div class="date_day">
                <asp:Literal ID="DateDay" runat="server"></asp:Literal>
            </div>
        </div>
        <div id="post-516" class="post">
            <h2 id="PostTitle" runat="server">
            </h2>
            <asp:Literal ID="PostTags" runat="server" />
            <div class="entry">
                <p id="posttext" runat="server">
                </p>
                <p id="authorp" runat="server">
                </p>
            </div>
        </div>
        <asp:PlaceHolder ID="CommentsPlaceHolder" runat="server">
            <asp:Literal ID="Comments" runat="server" />
            <h3 id="respond">Leave a Reply</h3>
            <div id="replydiv">
                <div id="commentAuthorDiv">
                    <input type="text" id="commentAuthor" />
                </div>
                <div id="commentTextDiv">
                    <textarea rows="" cols="" id="commentText"></textarea>
                    <img id="submitComment" class="imagebutton" src=""
                        width="60px" alt="Alternate Text" />
                </div>
            </div>
        </asp:PlaceHolder>
    </div>
</asp:Content>
